import sys
from PyQt5.Qt import *
import res.res_rc
from PIL import Image, ImageQt


class Window(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.vBox = QVBoxLayout(self)
        self.vBox.setContentsMargins(0, 0, 0, 0)
        self.vBox.setSpacing(0)
        file = r"G:\手机\壁纸\电脑壁纸\1689637545648.png"
        img = Image.open(file)
        img.thumbnail((200, 120))

        label = QLabel()
        label.setPixmap(ImageQt.toqpixmap(img))

        self.vBox.addWidget(label)


if __name__ == '__main__':
    QApplication.setHighDpiScaleFactorRoundingPolicy(
        Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
    QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)

    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(True)
    demo = Window()
    demo.resize(800, 600)
    demo.show()
    sys.exit(app.exec_())
